Return to RingdateR Help webpage

Introduction

RingdateR is designed to facilitate visual and statistical crossdating of tree ring and growth increment width series of both live- and dead-collected samples. RingdateR has a particular focus on facilitating the crossdating of dead-collected samples, with unknown antiquities, either against each other (i.e. pairwise analysis) or an existing absolutely dated chronology. As RingdateR is a crossdating application, it has not been designed for the construction of chronologies and as such does not contain facilities for performing regional curve standardisation or signal free detrending or more sophisticated tools for combining data sets into robust mean chronologies. The tools set out in RingdateR are designed to facilitate the evaluation of growth patterns in annually resolved archives to facilitate the dating of samples either relative to each other, or relative to an existing mean chronology.

Before using any of the RingdateR functions, you will need to install the package from the CRAN library.

You will also need to load the package.

library(ringdater)

Loading Undated Time Series

RingdateR is compatable with an array of file formats including: csv, txt (tab delimitted), MS Excel, pos (cooRecorder), and lps (ImagePro). Loading series of any format follows a similar procedure:

###Example data can be downloaded from a GitHub repository at the following URL:

https://github.com/davidjreynolds/ringdater.git

After unzipping the example data to a known location, you can proceed to load the data into R using various data loading functions.

make sure to set your working directory to the foler containing the unzipped example data

###Load undated series

Files can be in several formats including: ImagePro (lps), CooRecorder (pos), Comma separated values (csv), Tab delimmited (txt) files

exampleData <- load_undated("example_data/example_data/UndatedSeries.csv")

The following example is based on the csv file data loaded above

Preview the rwl data

Preview
ring x021a x021b x022a x022b
1 130.22 536 180 201
2 112.00 447 185 189
3 75.00 281 148 162
4 135.00 314 162 163
5 132.00 284 101 99

Detrending ring width data

detrending.plot.fun(undet.data = exampleData, first_series = "x021a", detrending_select = 3, splinewindow = 21, 
font_size = 12, axis_line_width = 0.5, plot_line = 0.5)

detrendedData <- normalise(the.data = exampleData, detrending_select = 3, splinewindow = 7)

Lead-lag analysis

Pairwise analysis performs corelations of all possible sample pairings at all lags requested. In this case we will compare all samples at lags ranging from -20 to +20.

The summary of results of one such pairwise comparison is printed here:

The pairwise lead-lag analysis function returns a list. In order to access the data, we ask for the first item in the list with [[1]]. To choose one analysis, we subset by row, and to view the best match, we also subset the first several columns.

pairwiseData <- lead_lag_analysis(the_data = detrendedData, mode = 1, neg_lag = -20, pos_lag = 20, complete = TRUE, shiny = FALSE)
Pairwise Corelations
Series #1 Series #2 First ring Last ring col 1st lag (years) 1st R 1st P 1st Overlap 2nd lag (years) 2nd R 2nd P 2nd Overlap 3rd lag (years) 3rd R 3rd P 3rd Overlap
x021a x021a 1 47 2 NA NA NA NA NA NA NA NA NA NA NA NA
x021a x021b -9 47 3 -10 0.6697708 0.0000299 47 28 0.4720256 4.708187 19 -34 0.4282320 4.729755 23
x021a x022a -44 16 4 -45 0.7328853 0.1512221 16 23 0.4373638 3.974561 24 35 0.5986764 4.844876 12
x021a x022b -44 15 5 -45 0.6069862 1.9699903 15 -29 0.4274584 1.975096 31 23 0.4351970 4.025886 24
x021a x023a 0 93 6 -1 0.3235295 4.9882274 47 -85 0.7204596 5.369449 9 20 0.4201840 5.470187 27
x021a x023b 21 103 7 20 0.4449972 3.3242105 27 -69 0.5323146 8.308338 14 8 0.3011750 10.364873 39
x021a x024a -42 8 8 -43 0.8645829 0.5706582 8 -14 0.4142187 1.102708 37 33 0.4840157 8.106943 14
x021a x024b -14 37 9 -15 0.4749103 0.3096162 37 -44 0.8351851 1.024882 8 7 0.2921888 7.001466 40
x021a x025a -11 45 10 -12 0.3545552 1.9222472 45 1 0.3299084 2.867276 46 19 0.3916460 4.479806 28
x021a x025b -39 10 11 -40 0.7357119 1.5292573 10 18 0.3870535 3.805183 29 0 0.2751372 6.124001 47

Line plot of Series vs. the Chronology

Examine one of the undated series plotted against the chronology at the strongest lag position

The lag position is taken from the table above

line_plot(the_data = detrendedData, series_1 = "x021a", "x032a", lag = 30)

Lead-lag results bar chart

Examine the lead-lag results between the two samples as a bar chart

lead_lag_bar(the_data = as.data.frame(pairwiseData[2]), sample_1 = "x021b", sample_2 = "x032a")

Lead-lag results heatmap

The heatmap provides an additional visual tool for assessing the crossdating. The sample numbers come from the column positions of the samples: “sc52l_l1” is sample 2 and “sc55r_l2” is sample 5.

heatmap_analysis(the_data = detrendedData, s1 = "x032a", s2 = "x021b") 

Check statistics

First we can filter the pairwise data by r-value, p-value, overlap, and sample ID.

filtered_data <- filter_crossdates(the_data = as.data.frame(pairwiseData[1]), r_val = 0.6, p_val = 0.01, overlap = 30, target = "x032a")
Filtered Data Preview
Series..1 Series..2 First.ring Last.ring col X1st.lag..years. X1st.R X.1st.P X1st.Overlap
365 x032a x032b 2 52 25 1 0.969 0.0000000 51
49 x021b x032a 3 54 24 2 0.642 0.0000329 52
296 x028a x032a 21 72 24 20 0.606 0.0051007 39
308 x028b x032a 21 72 24 20 0.620 0.0023798 40
338 x030a x032a -20 31 24 -21 0.661 0.0052835 31
346 x030b x032a -19 32 24 -20 0.665 0.0034885 32

Align and plot the data

We can now align and plot all of the data that meets the criterea set above.

aligned_data <- align_series(the_data = detrendedData, cross_dates = filtered_data, sel_target = "x032a")

plot_all_series(aligned_data)

Evaluate the newly aligned data

Correlations between each sample and the arithemtic mean chronology with replacement.

alignmentStats <- correl_replace(aligned_data)

View the stats

Aligned Data
Series ID First Ring Last ring R value P value Overlap with chronology
cor x032a 1 52 0.8574866 0 52
cor1 x032b 2 52 0.8746878 0 51
cor2 x021b -1 55 0.6566062 0 57
cor3 x028a -19 39 0.7248245 0 59
cor4 x028b -19 40 0.7257148 0 60
cor5 x030a 22 56 0.8210364 0 35
cor6 x030b 21 56 0.8650643 0 36